package date;

import java.text.DateFormat;
import java.util.Date;

/**
 * ClassName:DateFormatTest
 * Package:date
 * Description
 *
 * @Author:@wenxueshi
 * @Create:2023/7/22 - 16:43
 * @Version:v1.0
 */
public class DateFormatTest {

    public static void main(String[] args) {
        Date date = new Date();
        //处理日期转换
        DateFormat dateInstance = DateFormat.getDateInstance();
        // 2023-7-22
        System.out.println(dateInstance.format(date));

        //处理时间转换
        DateFormat timeInstance = DateFormat.getTimeInstance();
        //16:46:04
        System.out.println(timeInstance.format(date));

        //处理日期时间转换
        DateFormat dateTimeInstance = DateFormat.getDateTimeInstance();
        //2023-7-22 16:46:43
        System.out.println(dateTimeInstance.format(date));
    }
}
